package com.smartEdu.websocket;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import com.smartEdu.websocket.HandshakeInterceptor;

import com.smartEdu.websocket.WebsocketEndPoint;

/**
 * @see 配置websocket
 * @author holy
 * @2016-6-3
 */
@Configuration
@EnableWebSocket//开启websocket
public class WebSocketConfig implements WebSocketConfigurer {
    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
        registry.addHandler(new WebsocketEndPoint(),"/websocket.sk").addInterceptors(new HandshakeInterceptor()); //支持websocket 的访问链接
    }
}
